package car.slyc;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

/**
 * 资源映射路径
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {


    @Override
    public void addViewControllers(ViewControllerRegistry registry) {

    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry.addResourceHandler("/static/**", "/templates/**", "/public/**")
                .addResourceLocations("/static/", "classpath:/templates/", "file:E:\\code\\slyc\\slyc\\src\\main\\resources\\public\\");

    }



//    @Autowired
//    private LogServiceImpl logService;
//
//    //    添加拦截器对象  注入到容器中
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//
//        //注册LoginInterceptor 拦截器
//        InterceptorRegistration registration = registry.addInterceptor(new LoginInterceptor());
//        registration.addPathPatterns("/**");  //所有路径都被拦截
//        registration.excludePathPatterns(  //添加不拦截的路径
//                "/",
//                "/**/login",
//                "/**/regist",
//                "/**/add",
//                "/**/del",
//                "/**/update",
//                "/**/getbyid",
//                "/**/qt/**",
//                "/**/*.css",
//                "/**/*.js",
//                "/upload/*",
//                "/**/*.png",
//                "/**/*.jpg",
//                "/**/*.jpeg",
//                "/**/*.gif",
//                "/**/fonts/**",
//                "/**/*.svg"
//
//        );
//        //添加拦截器，配置拦截地址
//        registry.addInterceptor(new LogInterceptor(logService))
//                .addPathPatterns("/**")
//                 .excludePathPatterns("/assets/**","/css/**","/css2/**","/img/**","/js","/layui/**","/Resources/**"
//                         ,"/them2/**");
//    }





}
